<template>
  <!-- 任务管理 -->
  <div>
    <search-form
      :search-config="searchConfig"
      :label-width="150"
      @clear="clearSearch"
      @search="handleSearch"
    />
    <c-permission-tabs v-model="activatedType" code="tab">
      <el-tab-pane label="全部" name="all" opt-code="all">
        <List ref="tabTable" :serach-filters="serachFilters" :active-type="activatedType" type="all" />
      </el-tab-pane>
      <el-tab-pane label="待分配" name="allot" opt-code="allot">
        <List ref="tabTable" :serach-filters="serachFilters" :active-type="activatedType" type="allot" />
      </el-tab-pane>
      <el-tab-pane label="待处理" name="deal" opt-code="deal">
        <List ref="tabTable" :serach-filters="serachFilters" :active-type="activatedType" type="deal" />
      </el-tab-pane>
    </c-permission-tabs>
  </div>
</template>

<script>
import List from './components/list'
export default {
  name: 'PCTask',
  components: {
    List
  },
  data() {
    return {
      activatedType: '',
      searchConfig: [
        {
          label: '任务来源',
          prop: 'source',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/PRODUCT_CONFIG_TASK_SOURCE?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        },
        {
          label: '产品配置类型',
          prop: 'proConfigType',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/PRO_CONFIG_TYPE?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        },
        { label: '门店建设项目号', prop: 'constCode', type: 'text', value: '', placeholder: '' },
        {
          label: '门店',
          prop: 'shopCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'get',
            remoteUrl: '/select-service/api/v1/shop/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: []
          },
          dialogConfig: {
            title: '选择表格数据',
            interfacePath: '/select-service/api/v1/shop/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '所属办事处',
          prop: 'officeCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'get',
            remoteUrl: '/select-service/api/v1/organization/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: []
          },
          dialogConfig: {
            title: '选择表格数据',
            interfacePath: '/select-service/api/v1/organization/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            filtersRaw: [{ 'id': 'isOffice', 'property': 'isOffice', 'value': '1', 'operator': '=' }],
            pageFlag: true
          }
        },
        {
          label: '产品配置任务进度',
          prop: 'schedule',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/PRODUCT_CONFIG_TASK_SCHEDULE?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        }
      ],
      serachFilters: [],
      type: ''
    }
  },
  created() {
  },
  methods: {
    // 清空搜索条件
    clearSearch(data) {
      this.serachFilters = []
    },
    // 获取搜索条件
    handleSearch(data) {
      this.serachFilters = data.filtersRaw
    }
  }
}
</script>
